<% type = params[:user].present? ? 'user' : 'group' %>
hide_modal();
<% if @error.blank? %>
  show_add_team_member_dialog("<%= type %>", "<%= "#{type.capitalize} '#{escape_javascript(@member.name)}' added." %>")
  $j("#team_<%= type %>_members").html("<%= escape_javascript(render("#{type}_list")) %>");
  <% if @team.name == Team::ADMINS %>
    $j("#page_alert").html("<%= escape_javascript(render('organization/page_alert')) %>");
  <% end %>
<% else %>
  show_add_team_member_dialog("<%= type %>", null, "<%= escape_javascript(@error) %>")
<% end %>
